package com.svs.system.domain;

import java.util.Date;
import java.util.List;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.svs.common.annotation.Excel;
import com.svs.common.base.BaseEntity;

/**
 * 用户对象 sys_user
 * 
 * @author dujianqiao
 */
public class SysUser extends BaseEntity<SysUser> {

	private static final long serialVersionUID = 1L;

	/** 用户ID */
	@Excel(name = "用户序号")
	private Long userId;
	
	private List<Long> userIdList;

	/** 部门ID */
	private Long deptId;

	/** 部门父ID */
	private Long parentId;

	/** 登录名称 */
	@Excel(name = "登录名称")
	private String loginName;

	/** 用户名称 */
	@Excel(name = "用户名称")
	private String userName;

	/** 用户邮箱 */
	@Excel(name = "用户邮箱")
	private String email;

	/** 手机号码 */
	@Excel(name = "手机号码")
	private String phonenumber;

	/** 用户类型 */
	@Excel(name = "用户类型")
	private String userType;
	
	private String notUserType;
	
	private Long qyId;
	
	private List<Long> qyIdList;

	/** 所属企业 */
	@Excel(name = "所属企业")
	private String belongOrg;

	/** 用户性别 */
	@Excel(name = "用户性别")
	private String sex;

	/** 用户头像 */
	private String avatar;

	/** 密码 */
	private String password;
	
	/** 新密码 */
	private String passwordNew;

	/** 盐加密 */
	private String salt;

	/** 帐号状态（0正常 1停用） */
	@Excel(name = "帐号状态")
	private String status;
	
	private String statusName;

	/** 最后登陆IP */
	@Excel(name = "最后登陆IP")
	private String loginIp;

	/** 最后登陆时间 */
	@Excel(name = "最后登陆时间")
	private Date loginDate;

	/** 部门对象 */
	private SysDept dept;

	private List<SysRole> roles;

	/** 角色组 */
	private Long[] roleIds;

	/** 岗位组 */
	private Long[] postIds;

	Long roleId;
	private String token;
	
	private String province;
	private String city;
	private String area;
	private String town;
	private String provinceCode;
	private String cityCode;
	private String areaCode;
	private String townCode;
	
	private String enterName;
	private String enterCategory;
	
	private Integer dayCount;
	private Integer count;
	private Integer monthCount;
	
	public List<Long> getQyIdList() {
		return qyIdList;
	}

	public void setQyIdList(List<Long> qyIdList) {
		this.qyIdList = qyIdList;
	}

	public Integer getDayCount() {
		return dayCount;
	}

	public void setDayCount(Integer dayCount) {
		this.dayCount = dayCount;
	}

	public Integer getCount() {
		return count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	public Integer getMonthCount() {
		return monthCount;
	}

	public void setMonthCount(Integer monthCount) {
		this.monthCount = monthCount;
	}

	public String getPasswordNew() {
		return passwordNew;
	}

	public void setPasswordNew(String passwordNew) {
		this.passwordNew = passwordNew;
	}

	public String getEnterName() {
		return enterName;
	}

	public void setEnterName(String enterName) {
		this.enterName = enterName;
	}

	public String getEnterCategory() {
		return enterCategory;
	}

	public void setEnterCategory(String enterCategory) {
		this.enterCategory = enterCategory;
	}

	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}

	public String getTown() {
		return town;
	}

	public void setTown(String town) {
		this.town = town;
	}

	public String getProvinceCode() {
		return provinceCode;
	}

	public void setProvinceCode(String provinceCode) {
		this.provinceCode = provinceCode;
	}

	public String getCityCode() {
		return cityCode;
	}

	public void setCityCode(String cityCode) {
		this.cityCode = cityCode;
	}

	public String getAreaCode() {
		return areaCode;
	}

	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}

	public String getTownCode() {
		return townCode;
	}

	public void setTownCode(String townCode) {
		this.townCode = townCode;
	}

	public String getStatusName() {
		return statusName;
	}

	public void setStatusName(String statusName) {
		this.statusName = statusName;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public String getDeptName() {
		SysDept sysdept = getDept() ;
		return null != sysdept ? sysdept.getDeptName():"" ;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public boolean isAdmin() {
		return isAdmin(this.userId);
	}

	public static boolean isAdmin(Long userId) {
		return userId != null && 1L == userId;
	}

	public Long getDeptId() {
		return deptId;
	}

	public void setDeptId(Long deptId) {
		this.deptId = deptId;
	}

	public Long getParentId() {
		return parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhonenumber() {
		return phonenumber;
	}

	public void setPhonenumber(String phonenumber) {
		this.phonenumber = phonenumber;
	}

	public String getUserType() {
		return userType;
	}

	public void setUserType(String userType) {
		this.userType = userType;
	}

	public String getBelongOrg() {
		return belongOrg;
	}

	public void setBelongOrg(String belongOrg) {
		this.belongOrg = belongOrg;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getAvatar() {
		return avatar;
	}

	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getLoginIp() {
		return loginIp;
	}

	public void setLoginIp(String loginIp) {
		this.loginIp = loginIp;
	}

	public Date getLoginDate() {
		return loginDate;
	}

	public void setLoginDate(Date loginDate) {
		this.loginDate = loginDate;
	}

	public SysDept getDept() {
		return dept;
	}

	public void setDept(SysDept dept) {
		this.dept = dept;
	}

	public List<SysRole> getRoles() {
		return roles;
	}

	public void setRoles(List<SysRole> roles) {
		this.roles = roles;
	}

	public Long[] getRoleIds() {
		return roleIds;
	}

	public void setRoleIds(Long[] roleIds) {
		this.roleIds = roleIds;
	}

	public Long[] getPostIds() {
		return postIds;
	}

	public void setPostIds(Long[] postIds) {
		this.postIds = postIds;
	}

	public Long getRoleId() {
		return roleId;
	}

	public void setRoleId(Long roleId) {
		this.roleId = roleId;
	}

	public Long getQyId() {
		return qyId;
	}

	public void setQyId(Long qyId) {
		this.qyId = qyId;
	}

	public List<Long> getUserIdList() {
		return userIdList;
	}

	public void setUserIdList(List<Long> userIdList) {
		this.userIdList = userIdList;
	}

	public String getNotUserType() {
		return notUserType;
	}

	public void setNotUserType(String notUserType) {
		this.notUserType = notUserType;
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("userId", getUserId())
				.append("deptId", getDeptId()).append("loginName", getLoginName()).append("userName", getUserName())
				.append("email", getEmail()).append("phonenumber", getPhonenumber()).append("sex", getSex())
				.append("avatar", getAvatar()).append("password", getPassword()).append("salt", getSalt())
				.append("status", getStatus()).append("delFlag", getDelFlag()).append("loginIp", getLoginIp())
				.append("loginDate", getLoginDate()).append("createBy", getCreateBy())
				.append("createTime", getCreateTime()).append("updateBy", getUpdateBy())
				.append("updateTime", getUpdateTime()).append("remark", getRemark()).toString();
	}
}
